import axios from 'axios'

// axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
// const baseUrlKang = 'http://:8080' // 康
const baseUrlRen = 'http://' // 康
// const baseUrlTest = 'http://10.112.70.120:8080' // 任
// 10.112.19.138:8080
const instance = axios.create()
instance.defaults.timeout = 10000
instance.interceptors.request.use((config) => {
  instance.defaults.headers['Content-Type'] = 'application/json;charset=UTF-8'
  return config
}, (error) => {
  return Promise.reject(error)
})
export function fetch (url, params) {
  return new Promise((resolve, reject) => {
    instance.post(url, params)
      .then(response => {
        resolve(response)
      })
      .catch(error => {
        reject(error)
      })
  })
}
export default {
  getSubjectList (params) {
    return fetch(`${baseUrlRen}/recruit_wechat/major_management/get_subject`, params)
  }
}
